home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MACD 5
/
MACD 5.bin
/
workbench
/
libs
/
unixlib.lha
/
unix
/
test
/
dup2_test.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-09-05
|
253b
|
19 lines
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
int
main(void)
{
int fd;
fd = open("pippo", O_WRONLY | O_CREAT | O_TRUNC, 400);
write(fd, "pluto\n", 6);
dup2(fd, 1);
write(1, "nave\n", 5);
printf("prua\n");
close(fd);
return(0);
}